﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

#if WPF
using Silverlight.Hosting.Wpf.Interop;
using EventArgs = System.Windows.RoutedEventArgs;

namespace Silverlight.Hosting.Wpf.Private
#else
using Silverlight.Hosting.Interop;

namespace Silverlight.Hosting.Private
#endif
{
    internal class XcpContainerProxy : XcpContainer, IXcpContainerProxy
    {
        private ISilverlightHost _host;

        public XcpContainerProxy(ISilverlightHost host)
            : base(false)
        {
            _host = host;
        }

        #region Protected Properties

        /// <summary>
        /// Gets the Silverlight plug-in host
        /// </summary>
        protected override ISilverlightHost Host
        {
            get { return _host; }
        }

        #endregion

        #region Protected Methods

        protected override DownloadResult DownloadUrl(string url, IDownloadUrlCallback callback, out Stream stream)
        {
            return _host.DownloadUrl(url, callback, out stream);
        }

        protected override void OnCreated(EventArgs e)
        {
            _host.OnCreated(e);
        }

        protected override void OnSilverlightLoaded(EventArgs e)
        {
            _host.OnSilverlightLoaded(e);
        }

        protected override void OnSilverlightError(SilverlightErrorEventArgs e)
        {
            _host.OnSilverlightError(e);
        }

        protected override void OnSilverlightEvent(SilverlightEventArgs e)
        {
            _host.OnSilverlightEvent(e);
        }

        protected override void OnSourceDownloadComplete(EventArgs e)
        {
            _host.OnSourceDownloadComplete(e);
        }

        protected override void OnSourceDownloadProgressChanged(SourceDownloadProgressChangedEventArgs e)
        {
            _host.OnSourceDownloadProgressChanged(e);
        }

        protected override void OnContentLoaded(EventArgs e)
        {
            _host.OnContentLoaded(e);
        }

        protected override void OnContentError(ErrorEventArgs e)
        {
            _host.OnContentError(e);
        }

        protected override void OnContentZoomed(EventArgs e)
        {
            _host.OnContentZoomed(e);
        }

        protected override void OnContentResized(EventArgs e)
        {
            _host.OnContentResized(e);
        }

        protected override void OnFullScreenChanged(EventArgs e)
        {
            _host.OnFullScreenChanged(e);
        }

        #endregion

        #region IXcpContainerProxy

        public DownloadResult InvokeBaseDownloadUrl(string url, IDownloadUrlCallback callback, out Stream stream)
        {
            return base.DownloadUrl(url, callback, out stream);
        }

        public void InvokeBaseOnCreated(EventArgs e)
        {
            base.OnCreated(e);
        }
        
        public void InvokeBaseOnSilverlightLoaded(EventArgs e)
        {
            base.OnSilverlightLoaded(e);
        }

        public void InvokeBaseOnSilverlightError(SilverlightErrorEventArgs e)
        {
            base.OnSilverlightError(e);
        }

        public void InvokeBaseOnSilverlightEvent(SilverlightEventArgs e)
        {
            base.OnSilverlightEvent(e);
        }

        public void InvokeBaseOnSourceDownloadComplete(EventArgs e)
        {
            base.OnSourceDownloadComplete(e);
        }

        public void InvokeBaseOnSourceDownloadProgressChanged(SourceDownloadProgressChangedEventArgs e)
        {
            base.OnSourceDownloadProgressChanged(e);
        }

        public void InvokeBaseOnContentLoaded(EventArgs e)
        {
            base.OnContentLoaded(e);
        }

        public void InvokeBaseOnContentError(ErrorEventArgs e)
        {
            base.OnContentError(e);
        }

        public void InvokeBaseOnContentZoomed(EventArgs e)
        {
            base.OnContentZoomed(e);
        }

        public void InvokeBaseOnContentResized(EventArgs e)
        {
            base.OnContentResized(e);
        }
        

        public void InvokeBaseOnFullScreenChanged(EventArgs e)
        {
            base.OnFullScreenChanged(e);
        }

        #endregion
    }
}
